package com.kpijavatraining.module.utils;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.String;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactoryConfigurationError;
import org.xml.sax.SAXException;
import com.kpijavatraining.module.io.ConsoleReader;
import com.kpijavatraining.module.io.FileWriter;

public class Registrator {

	private Checker checker;
	private FileWriter writer;
	
	public Registrator() throws ParserConfigurationException, IOException, SAXException{
		checker  = new Checker();
		writer = new FileWriter();
	}
	
	public boolean register(String login , String password) throws TransformerFactoryConfigurationError, TransformerException, FileNotFoundException{

			if(checker.identification(login)){
				return false;
			}

		writer.write(login,password,"user");
		return true;
	}
}
